<template>
      <div>
        <table>
            <tr> 
                <td>名称</td>
                <td>操作</td>
            </tr>
            <tr v-for='i in list'>
                <td>{{i.name}}</td>
                <td>
                    <router-link :to="{name:'updatecate',query:{'id'
                    :i.item-date}}">修改</router-link>删除
                </td>
            </tr>  
            <tr>
                <td>
                    <van-paginstion
                        v-model='currentPage'
                        :total-items='total'
                        :items-per-page='3'
                        force-ellipses/>
                </td>
            </tr>

        </table>
    </div>
</template>

<script>
export default {
    data(){
        return{
            list:[],
            total:10,
            currentPage:1
        }
    },
    methods:{
        //v形参，传递当前页数
        getlist(v){
            this.currentPage = v
            this.axios.get('cateM?page='+v).then(res=>{
                this.list=res.data.list
                this.total=res.data.total
            })
        },
        //删除
        del(id){
            this.axios.delete('cateM?id='+id).then(res=>{
                this.getlist(1)
            })
        }
    },
    mounted() {
        this.getlist(1)   
         },

}
</script>

<style>

</style>
